<!DOCTYPE html >
<html>
<head>
	<meta charset="utf-8">
	<title>container连接node</title>
	<script src="http://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js" type="text/javascript"></script>
	<script src="jtp/jtopo-0.4.8-min.js" type="text/javascript"></script>

	<script type="text/javascript">
		$(document).ready(function(){





			var canvas = document.getElementById('canvas'); //舞台
			var stage = new JTopo.Stage(canvas);//场景
			//显示工具
			var scene = new JTopo.Scene(stage);

			var node = new JTopo.Node("Hello");
			node.setBound(10, 10,200,200);
			node.fontColor="0,0,0";

			var container=new JTopo.Container("hello2333333");
			container.setBound(560,60,100,100);
			scene.add(container)


			scene.add(node);

			var link=new JTopo.Link(node,container)
			link.getStartPosition = function() {
				var a;
				return (a = (function(thisl){
					var b=thisl.nodeA,c=thisl.nodeZ;
					var d = JTopo.util.lineF(b.cx, b.cy, c.cx, c.cy),
							e = b.getBound(),
							f = JTopo.util.intersectionLineBound(d, e);
					return f
				})(this)),
				null == a && (a = {
					x: this.nodeZ.cx,
					y: this.nodeZ.cy
				}),a

			};

			link.getEndPosition = function() {
				var a;
				return (a = (function(thisl){
					var b=thisl.nodeZ,c=thisl.nodeA;
					var d = JTopo.util.lineF(b.cx, b.cy, c.cx, c.cy),
							e = b.getBound(),
							f = JTopo.util.intersectionLineBound(d, e);
					return f
				})(this)),
				null == a && (a = {
					x: this.nodeZ.cx,
					y: this.nodeZ.cy
				}),a

			};

			scene.add(link);


		});

	</script>
</head>
<body>
<canvas width="800"height="500"id="canvas"style=" background-color:#EEEEEE; border:1px solid #444;">
</canvas>
</body>
</html>